#ifndef TASKATTRMODEL_H
#define TASKATTRMODEL_H

#include "DataView_global.h"

namespace xvs {


/**
 * @brief The TaskAttrModel class   该Model展示某任务(SetTaskObj)中的指令及其拥有的属性对象
 */
class DATAVIEW_EXPORT TaskAttrModel : public QAbstractItemModel
{
    Q_OBJECT
public:
    TaskAttrModel();

    void SetTaskObj(TaskObj* obj);

    XVObject *ObjFromIndex(QModelIndex index);

    QModelIndex IndexFromObj(XVObject* obj);

    void Refresh();

    void BeginInsertRows(int first,int last = 0);
    void EndInsertRows();

public:
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
    QModelIndex index(int row, int column, const QModelIndex &parent) const override;
    QModelIndex parent(const QModelIndex &child) const override;
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    int columnCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
    bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
    Qt::ItemFlags flags(const QModelIndex &index) const override;

private:
    TaskObj* mTaskObj;
};




}

#endif // TASKATTRMODEL_H
